<?php

namespace app\admins\controller;

use think\Controller;
use Util\SysDb;

class Pswchange extends Controller
{
    public function pswChange()
    {
        $name = trim(input('param.username'));
        $psw = trim(input('param.password'));
        $psd = md5($psw);
        $data['password'] = $psd;
        $this->db = new SysDb();
        $this->db->table('admins')->where(['username' => $name])->update($data);
        exit(json_encode(['code' => 0, 'msg' => '密码修改成功,下次登陆请用新密码']));
    }
}
